<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html lang="fr">
	<head>
		<title>Back office Bitstrip(s) - Gérer les images de fond</title>
		<meta charset="UTF-8"/>
		<link rel="stylesheet" type="text/css" href="/bitstrip/assets/css/back_office.css"/>
        <link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
		<jsp:include page="menu_bo.jsp"/>
	</head>
	<body>
			<c:if test="${status.hasErrors()}"> 
			<div class="message-box error show">
				<c:forEach items="${status.getAllErrors()}" var="errorMessage">  
	            	<c:out value="${errorMessage.getDefaultMessage()}" /><br/>
	           	</c:forEach> 
			</div>
		</c:if>
		<c:if test="${ajouterVide == true}"> 
			<div class="message-box error show">
				Veuillez remplir tous les champs du formulaire. 
			</div>
		</c:if>	
	<div class="bo-container"> 
		<form:form commandName="fond" id="fond-ajout" action="/bitstrip/ajouter_fond" method="post" enctype="multipart/form-data">
			<fieldset>
			<legend>Nouvelle image de fond</legend>
					<form:hidden path="id"/>
					<form:hidden path="version"/>
			<h3>Nombre de personnes <br><form:input path="nb_personne" maxlength="2" placeholder="Nombre de personne" /></h3>
			  <br>
			  <br>
       		<h3>Thème    <form:select path="theme" itemValue="id" itemLabel="nom_theme" items="${listeTheme}"  ></form:select></h3>
			<br>
			<h3>Image de fond   <input type="file" name="image"/></h3>
			<div class="choix">
			<br>
			<b>Associez les mots clés correspondant à cette image de fond.<br></b>
			<c:forEach var="motCle" items="${listeMotCle}">
				<tr>
				<td>${motCle.label}</td>
				<td><input type="checkbox" name="motcle" value="${motCle.id}"/></td>
				</tr>
			</c:forEach>
			</div>
			<input type="submit" name="valider" value="Valider">
			</fieldset>
		</form:form>
	</div>
	</body>
</html>